import request from '@/utils/request'
/**
 *  获取所有权限点
 * @param {*} data
 * @returns
 */
export const getPermissionList = () => {
  return request({
    url: '/sys/permission',
    method: 'GET'
  })
}
/**
 *  添加权限
 * @param {*} data  对象
 * @returns
 */
export const addPermission = (data) => {
  return request({
    url: '/sys/permission',
    method: 'POST',
    data
  })
}
/**
 *  根据ID获取权限点详情
 * @param {*} id
 * @returns
 */
export const getPermissionInFo = (id) => {
  return request({
    url: '/sys/permission/' + id,
    method: 'GET'
  })
}
/**
 * 根据ID更新权限点详情
 * @param {*} data  编辑的权限信息
 * @returns
 */
export const updatePermissionInFo = (data) => {
  return request({
    url: '/sys/permission/' + data.id,
    method: 'PUT',
    data
  })
}
/**
 *  根据id删除权限点
 * @param {*} id 权限点 id
 * @returns
 */
export const delPermissionInFo = (id) => {
  return request({
    url: '/sys/permission/' + id,
    method: 'DELETE'

  })
}
/**
 *  给角色分配权限
 * @param {*} data 对象
 * @returns
 */
export const setPermissionToRole = (data) => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'PUT',
    data
  })
}
